
from langchain_core.messages import ChatMessage,HumanMessage,AIMessage
from typing import Literal

role = Literal['human', 'ai']
def construct_chat_message(history:list,input:str,mode:role):
    if mode == 'human':
        history.append(HumanMessage(content=input))
    elif mode == 'ai':
        history.append(AIMessage(content=input))
    else:
        raise ValueError(f"mode must be 'human' or 'ai'")







